import * as fs from 'fs';
import { parsePublishDate, parseLikeNumber, randomWait, parseNoteId } from './utility';
import path from 'path';
import { unlinkSync } from 'fs';
import LarkClient from '../../lark-sdk/LarkClient';

export interface Note {
  recordId?: string;
  id?: number;
  noteId?: string;
  url?: string;
  liveable?: boolean;
  title?: string;
  authorId?: string;
  author?: string;
  authorFollows?: number;
  authorFans?: number;
  authorInteraction?: number;
  content?: string;
  publishDate?: number;
  likeCount?: number;
  collectCount?: number;
  commentCount?: number;
  screenshotPath?: string;
  screenshotFileToken?: string;
  comments?: Comment[];
}

export interface Comment {
  noteInfoId?: number;
  author?: string;
  authorId?: string;
  content?: string;
  plainTextContent?: string;
  publishDate?: number;
  likeCount?: number;
  replyCount?: number;
}

export interface NoteMonitorInfo extends Note {
  referenceNoteId: string;
}

export interface UserInteractInfo {
  fans: number;
  interaction: number;
  follows: number;
}

export const JiankongBijiSchema = {
  id:'编号',
  url:'链接',
  publishDate:'发布日期',
  latestCrawlTime:'最后爬取时间',
  latestNoteInfoId:'最新监控笔记信息编号',
  crawlCommentFailed:'爬观点失败',
}

export const JiankongBijiXinxiSchema = {
  id:'编号',
  referenceNoteId:'监控笔记编号',
  noteId:'笔记编号',
  url:'链接',
  crawlTime:'爬取时间',
  publishDate:'发布日期',
  liveable:'可访问',
  content:'内容',
  title:'标题',
  author:'作者',
  authorId:'作者ID',
  likeCount:'点赞数',
  collectCount:'收藏数',
  commentCount:'评论数',
  screenshot:'截图',
}

export const JiankongGuandianXinxiSchema = {
  noteInfoId:'监控笔记信息编号',
  content:'内容',
  plainTextContent:'纯文本内容',
  publishDate:'发布日期',
  likeCount:'点赞数',
  replyCount:'评论数',
  author:'作者',
  authorId:'作者ID',
}
